#pragma once

#include "RAM.h"

#define DEFUALT_SIZE 1024

namespace VirtualHardware
{
	public ref class CallStack
	{
	public:
		property UInt32 default[UInt32]
		{
			virtual UInt32 get(UInt32 i)
			{
				return GetValueAt(i);
			}

			virtual void set(UInt32 i, UInt32 value)
			{
				SetValueAt(i, value);
			}
		}

		CallStack(RAM^ memory);
		CallStack(RAM^ memory, int baseOffset);
		CallStack(RAM^ memory, int baseOffset, int size);

		virtual inline UInt32 GetValueAt(UInt32 i);
		virtual inline void SetValueAt(UInt32 i, UInt32 value);
		Boolean LoadDataArray(array<UInt32>^ dataHandle, UInt32 startAddress);

	private:
		int size;
		int growthSize;
		int baseOffset;
		RAM^ memory;

		void Grow();
	};
}
